package com.aos.erp.gov.ex.mapper;

import com.aos.erp.common.dao.mapper.SuperMapper;
import com.aos.erp.gov.ex.enums.RegisterTaskType;
import com.aos.erp.gov.ex.model.GovExRegisterTask;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface GovExRegisterTaskMapper extends SuperMapper<GovExRegisterTask> {

    int saveSubmitted(@Param("idnums") List<String> idnums, @Param("type") RegisterTaskType type, @Param("submittedTime") Date submittedTime);

    @Update("UPDATE T_GOV_EX_REGISTER_TASK SET status=1,type=#{type},submitted_time=#{submittedTime} where student_idnum=#{idnum} and status=0")
    int saveOneSubmitted(@Param("idnum") String idnum, @Param("type") RegisterTaskType type, @Param("submittedTime") Date submittedTime);


    int saveSuccess(@Param("idnums") List<String> idnums, @Param("type") RegisterTaskType type, @Param("backTime") Date backTime);

    @Update("UPDATE T_GOV_EX_REGISTER_TASK SET status=2,type=#{type},back_time=#{backTime} where student_idnum=#{idnum} and status<>2")
    int saveOneSuccess(@Param("idnum") String idnum, @Param("type") RegisterTaskType type, @Param("backTime") Date backTime);


    int saveFailed(@Param("idnums") List<String> idnums, @Param("type") RegisterTaskType type, @Param("backTime") Date backTime);

    @Update("UPDATE T_GOV_EX_REGISTER_TASK SET status=3,type=#{type},back_time=#{backTime} where student_idnum=#{idnum} and status<>3")
    int saveOneFailed(@Param("idnum") String idnum, @Param("type") RegisterTaskType type, @Param("backTime") Date backTime);
}
